def caesar(msg=None, code=None, offset=None, action=None):
    if action == 'encode' or action == 'Encode':
        iter = msg
    elif action == 'decode' or action == 'Decode':
        offset = - offset
        iter = code
    else:
        return "Error Action"

    final_code = []
    for i in iter:
        if not i.isalpha():
            result = chr(ord(i) + offset)
        else:
            base = "A" if i.isupper() else "a"
            result= chr((ord(i) - ord(base) + offset) % 26 + ord(base))
        #result = chr(ord(i) + offset)
        final_code.append(result)

    return final_code








